<?php
header("Content-type: text/javascript; charset=utf8");

include_once "config.php";

//define( "D_FOLDER", "decor/" );
//define( "D_SITE", "http://ok.onlife.mobi/".D_FOLDER );

$ret = array("error"=>0);
$db->real_query('SELECT * FROM `news` ORDER BY `id` ASC LIMIT 0, 50');

$q = $db->store_result();

if ( $q && $q->num_rows > 0 )
{
	$ret['news'] = array();
	while ( $arr = $q->fetch_array( MYSQLI_ASSOC ) ) {
		$ret['news'][] = $arr;
	}
	
}
else
{
	$ret['error'] = 12;
	$ret['description'] = 'Failed to execute the query';
}


echo json_encode($ret);
